package com.bodu.controller;

import com.bodu.service.GenCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 生成Code的代码
 * 传入表的名称，根据相应的规则生成代码
 */
@Slf4j
@RestController
@RequestMapping("code")
public class GenCodeController {

    @Autowired
    private GenCodeService genCodeService;

    /**
     * 生成所有的文件
     *
     * @param table
     * @return
     */
    @RequestMapping("/createAll/{schema}/{table}/{type}")
    public void creatAll(@PathVariable("schema") String schema, @PathVariable("table") String table, @PathVariable("type") Integer type) {
        genCodeService.createAll(schema, table, type);
    }
}
